import pymysql
conn=pymysql.connect(user='root',
                     password='hhf20101',
                     host='localhost',
                     database='books',
                     autocommit=True

                     )

cursor=conn.cursor()
sql = "insert into t_book(id, title, pub_date) values(4, '西游记', '1986-01-01');"
cursor.execute(sql)
print(cursor.rownumber)
print(cursor.rowcount)
cursor.close()
conn.close()